using System;using System.Data;using System.Data.SqlClient;using System.Collections.Generic;namespace MyWeb.Data{	public class FeatureDAL : SqlDataProvider	{
        #region[Feature_GetById]
        public List<Feature> Feature_GetById(string Id)
        {
            List<Data.Feature> list = new List<Data.Feature>();
            using (SqlCommand dbCmd = new SqlCommand("sp_Feature_GetById", GetConnection()))
            {
                Data.Feature obj = new Data.Feature();
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@Id", Id));
                SqlDataReader dr = dbCmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        list.Add(obj.FeatureIDataReader(dr));
                    }
                }
                dr.Close();
                //conn.Close();
            }
            return list;
        }
        #endregion
        #region[Feature_SelecTabsByProductId]
        public List<Feature> Feature_SelecTabsByProductId(string productsId)
        {
            List<Data.Feature> list = new List<Data.Feature>();
            using (SqlCommand dbCmd = new SqlCommand("sp_Feature_SelecTabsByProductId", GetConnection()))
            {
                Data.Feature obj = new Data.Feature();
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@ProductsId", productsId));
                SqlDataReader dr = dbCmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        list.Add(obj.FeatureIDataReader(dr));
                    }
                }
                dr.Close();
                //conn.Close();
            }
            return list;
        }
        #endregion		#region[Feature_GetByTop]		public List<Feature> Feature_GetByTop(string Top, string Where, string Order)		{			List<Data.Feature> list = new List<Data.Feature>();			using (SqlCommand dbCmd = new SqlCommand("sp_Feature_GetByTop", GetConnection()))			{				Data.Feature obj = new Data.Feature();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Top", Top));				dbCmd.Parameters.Add(new SqlParameter("@Where", Where));				dbCmd.Parameters.Add(new SqlParameter("@Order", Order));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.FeatureIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[Feature_GetByAll]		public List<Feature> Feature_GetByAll(string Lang)		{			List<Data.Feature> list = new List<Data.Feature>();			using (SqlCommand dbCmd = new SqlCommand("sp_Feature_GetByAll", GetConnection()))			{				Data.Feature obj = new Data.Feature();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.FeatureIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}			return list;		}		#endregion		#region[Feature_Paging]		public List<Feature> Feature_Paging(string CurentPage, string PageSize, string Lang)		{			List<Data.Feature> list = new List<Data.Feature>();			using (SqlCommand dbCmd = new SqlCommand("sp_Feature_Paging", GetConnection()))			{				Data.Feature obj = new Data.Feature();				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@CurentPage", CurentPage));				dbCmd.Parameters.Add(new SqlParameter("@PageSize", PageSize));				dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));				SqlDataReader dr = dbCmd.ExecuteReader();				if (dr.HasRows)				{					while (dr.Read())					{						list.Add(obj.FeatureIDataReader(dr));					}
                }
                dr.Close();
                //conn.Close();			}		return list;		}		#endregion		#region[Feature_Insert]		public bool Feature_Insert(Feature data)		{			using (SqlCommand dbCmd = new SqlCommand("sp_Feature_Insert", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@ProductsId", data.ProductsId == "" || data.ProductsId == "0" ? DBNull.Value : (object)data.ProductsId));				dbCmd.Parameters.Add(new SqlParameter("@TabsId", data.TabsId == "" || data.TabsId == "0" ? DBNull.Value : (object)data.TabsId));				dbCmd.Parameters.Add(new SqlParameter("@Detail", data.Detail));
                dbCmd.Parameters.Add(new SqlParameter("@Index", data.Index));
                dbCmd.Parameters.Add(new SqlParameter("@Date", data.Date));				dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));				dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("Feature");			return true;		}		#endregion		#region[Feature_Update]		public bool Feature_Update(Feature data)		{			using (SqlCommand dbCmd = new SqlCommand("sp_Feature_Update", GetConnection()))			{
                dbCmd.CommandType = CommandType.StoredProcedure;
                dbCmd.Parameters.Add(new SqlParameter("@Id", data.Id));				dbCmd.Parameters.Add(new SqlParameter("@ProductsId", data.ProductsId == "" || data.ProductsId == "0" ? DBNull.Value : (object)data.ProductsId));				dbCmd.Parameters.Add(new SqlParameter("@TabsId", data.TabsId == "" || data.TabsId == "0" ? DBNull.Value : (object)data.TabsId));				dbCmd.Parameters.Add(new SqlParameter("@Detail", data.Detail));
                dbCmd.Parameters.Add(new SqlParameter("@Index", data.Index));
                dbCmd.Parameters.Add(new SqlParameter("@Date", data.Date));				dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));				dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("Feature");			return true;		}		#endregion		#region[Feature_Delete]		public bool Feature_Delete(string Id)		{			using (SqlCommand dbCmd = new SqlCommand("sp_Feature_Delete", GetConnection()))			{				dbCmd.CommandType = CommandType.StoredProcedure;				dbCmd.Parameters.Add(new SqlParameter("@Id", Id));				dbCmd.ExecuteNonQuery();			}			//Clear cache			System.Web.HttpContext.Current.Cache.Remove("Feature");			return true;		}		#endregion			}}